<template>
  <div class="category-list">
    <van-tabs @click="itemClick" v-model="actives">
      <van-tab v-for="item in navData" :key="item.id" :title="item.name">
        <div class="category-list-main">
          <p class="title">{{ item.name }}</p>
          <p class="desc">{{ item.front_desc }}</p>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
// import { getCateGoryNav, getGoodsList } from "@/network/categorylist";
export default {
  props: {
    navData: {
      type: Array,
      default() {
        return [];
      },
    },
    actives: {
      type: Number,
    },
  },
  methods: {
    itemClick(name, title) {
      // console.log(1)
      console.log(name, title)
      this.actives = name
      console.log(this.actives)
      let id = this.navData[name].id;
      this.$emit("navListClick", id);
    },
  },
};
</script>

<style lang="scss" scoped>
.category-lists {
  margin-top: 44px;
}
.category-list-main {
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  margin: 10px 0 5px;
  p {
    margin: 5px 0;
  }
  .desc {
    color: #666;
  }
  .title {
    font-size: 16px;
  }
}
</style>